import 'package:bruno/bruno.dart';
import 'package:flutter/material.dart';
import 'package:getwidget/getwidget.dart';
import 'package:meal/constant/antd_icons.dart';
import 'package:meal/constant/sizes.dart';
import 'package:meal/utils/colors.dart';
import 'package:meal/utils/styles.dart';
import 'package:meal/utils/tools.dart';

class NewPassword extends StatefulWidget {
  const NewPassword({Key? key}) : super(key: key);

  @override
  State<NewPassword> createState() => _NewPasswordState();
}

class _NewPasswordState extends State<NewPassword> {

  bool eye = true;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: ColorsUtils.rgba(245, 245, 245),
      appBar: BrnAppBar(
        backgroundColor: ColorsUtils.rgba(255, 110, 83, 1),
        title: Text('设置新密码', style: StylesUtils.customTextStyle(fontSize: Sizes.default18)),
        elevation: 0,
        titleAlignment: Alignment.center,
        themeData: BrnAppBarConfig(
          iconSize: Sizes.default20,
          leadIconBuilder: () {
            return ToolsUtils.getAssetImageIcon('back.png');
          },
          leftAndRightPadding: Sizes.default10,
          titlePadding: EdgeInsets.zero,
        ),
      ),
      body: SingleChildScrollView(
        child: Container(
          decoration: const BoxDecoration(color: Colors.white),
          margin: const EdgeInsets.only(bottom: Sizes.default30),
          padding: const EdgeInsets.symmetric(horizontal: Sizes.default20),
          child: Column(
            children: [
              Container(
                margin: const EdgeInsets.only(top: Sizes.default20),
                alignment: Alignment.centerLeft,
                child: Text('设置新密码',
                    style: StylesUtils.customTextStyle(
                        color: ColorsUtils.color363, fontSize: Sizes.default30)),
              ),
              Container(
                margin: const EdgeInsets.only(top: Sizes.default20),
                alignment: Alignment.centerLeft,
                child: Row(
                  children: [
                    Expanded(
                        child: Container(
                          margin: const EdgeInsets.only(left: Sizes.default10),
                          child: TextField(
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color363, fontSize: Sizes.default16),
                            decoration: InputDecoration(
                                border: const OutlineInputBorder(
                                  borderSide: BorderSide.none,
                                ),
                                isCollapsed: true,
                                filled: true,
                                fillColor: ColorsUtils.rgba(255, 255, 255),
                                contentPadding: const EdgeInsets.symmetric(
                                    horizontal: Sizes.default10, vertical: Sizes.default10),
                                constraints: const BoxConstraints(minHeight: 40),
                                hintText: '请输入6-20位字母数字组合',
                                hintStyle: StylesUtils.customTextStyle(
                                    fontSize: Sizes.default15, color: ColorsUtils.colorCcc)),
                            keyboardType: TextInputType.visiblePassword,
                            obscureText: eye,
                            obscuringCharacter: '*',
                            onChanged: (String content) {},
                          ),
                        )),
                    Container(
                      constraints: BoxConstraints.tight(const Size.square(Sizes.default40)),
                      alignment: Alignment.center,
                      child: IconButton(
                          onPressed: () {
                            eye = !eye;
                            setState(() {});
                          },
                          icon: Icon(eye ? AntdIcons.eye : AntdIcons.eyeClose,
                              size: Sizes.default20,
                              color: ColorsUtils.parseColorFromHexString(ColorsUtils.color999))),
                    ),
                  ],
                ),
              ),
              Container(
                width: double.maxFinite,
                margin: const EdgeInsets.only(top: Sizes.default30, bottom: Sizes.default40),
                child: GFButton(
                    onPressed: () {

                    },
                    text: '确定',
                    textStyle: StylesUtils.customTextStyle(fontSize: Sizes.default16),
                    shape: GFButtonShape.pills,
                    type: GFButtonType.solid,
                    size: GFSize.LARGE,
                    color: ColorsUtils.parseColorFromHexString(ColorsUtils.colorFf6)),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

